package com.itheima.Demo01.demo05;

import java.util.concurrent.Callable;

public class MyCallable05 implements Callable<String> {
    private Object obj = new Object();

    @Override
    public String call() throws Exception {
        synchronized (obj) {
            for (int i = 0; i < 100; i ++) {
                Thread.sleep(100);
                i++;
                System.out.println(Thread.currentThread().getName() + "---" + i + "张票");
            }
            return "抱歉,票卖完了";
        }
    }
}

